/**ResultRecord.java
 * 
 * Description:
 * Bean class for one record of the search results.
 * 
 * Anping Zhou <anping.zhou@gmail.com>
 * Created: Jul 10, 2007
 */
package jp.ac.utokyo.pinyomi;

import java.math.BigDecimal;

/**
 * @author anping
 * Bean class for one record of the search results.
 */
public class ResultRecord  implements Comparable<ResultRecord>{
	private String translation = "";
	private String reading="";
	private String meaning="";
	private float luceneScore = 0;
	private double pinyomiScore = 1;

	public int compareTo(ResultRecord r) {
		if (this.pinyomiScore < r.pinyomiScore) return 1;
		if (this.pinyomiScore > r.pinyomiScore) return -1;
		return 0;
	}

	// //////////////////////////////////////
	// GETTERs & SETTERs
	// //////////////////////////////////////
	public float getLuceneScore() {
		return luceneScore;
	}
	public void setLuceneScore(float score) {
		this.luceneScore = score;
	}
	public String getTranslation() {
		return translation;
	}
	public void setTranslation(String translation) {
		this.translation = translation;
	}
	public String getReading() {
		return reading;
	}
	public void setReading(String reading) {
		this.reading = reading;
	}
	public String getMeaning() {
		return meaning;
	}
	public void setMeaning(String meaning) {
		this.meaning = meaning;
	}
	public double getPinyomiScore() {
		return pinyomiScore;
	}
	public double getPinyomiScore(int scal){
		BigDecimal ps = new BigDecimal(String.valueOf(getPinyomiScore()));
		return ps.setScale(scal, BigDecimal.ROUND_HALF_UP).doubleValue();
	}
	public void setPinyomiScore(double pinyomiScore) {
		this.pinyomiScore = pinyomiScore;
	}
}
